package com.dcd.service;

import com.dcd.pojo.Information;
import com.dcd.service.impl.InformationServiceImpl;
import org.apache.solr.client.solrj.SolrServerException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@Component
@FeignClient(name = "donchedi-provider9091", contextId = "information", fallback = InformationServiceImpl.class)
public interface InformationService {

    /**
     * 查询所有资讯
     *
     * @param pageZiXunIndex
     * @return
     */
    @RequestMapping("/InformationController/Information_all")
    Map<String, Object> Information_all(@RequestParam Integer pageZiXunIndex);

    /**
     * 根据资讯id查询单个资讯详情
     *
     * @param information_id 资讯id
     * @return 返回根据资讯id查询出来的一个对象
     */
    @RequestMapping("/InformationController/singleInformation")
    Information singleInformation(@RequestParam Integer information_id);

    /**
     * 查询前十的热搜榜
     *
     * @return
     */
    @RequestMapping("/InformationController/tenInfoAll")
    List<Information> tenInfoAll();

    /**
     * 查询首页最新24条资讯
     *
     * @return 返回24条最新资讯
     */
    @RequestMapping("/InformationController/select_index_information")
    List<Information> select_index_information();

    /**
     * 根据车系id查询此系列的所有资讯
     *
     * @param car_series_id 获取车系id
     * @return 返回同车系所有资讯
     */
    @RequestMapping("/InformationController/seleCarSeriesInformation")
    List<Information> seleCarSeriesInformation(@RequestParam Integer car_series_id);

    /**
     * 查询最近一周的最新资讯
     * @return
     */
    @RequestMapping("/InformationController/select_week")
    public List<Information> select_week();

    /**
     * 搜索查询资讯
     *
     * @param solr_content 搜索文本内容
     * @param page_index   当前页数
     * @return
     */
    @RequestMapping("/InformationController/select_information_by_solr")
    Map<String, Object> select_information_by_solr(@RequestParam String solr_content, @RequestParam int page_index) throws IOException, SolrServerException;
}
